﻿using SUNRPA.CONTROLS.IMPL.domain.attrubutes;
using SUNRPA.CONTROLS.IMPL.domain.flowRunningVar;
using SUNRPA.CONTROLS.IMPL.util;
using System.Collections.Concurrent;
/// <summary>
/// Excel有Office和Wps目前只支持Office后期加入Wps支持。
/// </summary>
namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [Serializable]
    [VarFieldName("OutExcelObj")]
    public class StartExcelNParam:BaseParam {
        //0打开已有Excel、1新建Excel
        private int startWay = 0;
        private string excelPath = "";
        //驱动方式0自动检测、1office、2wps
        private int driver = 0;
        private string outExcelObj = "excelObject";
        //打开密码
        private string startCode = "";
        //设置密码
        private string setCode = "";
        //可视化
        private bool isVisable = false;
        public bool IsVisable {
            get => isVisable; 
            set { 
                isVisable = value;
                NotifyPropertyChanged("IsVisable");
            }  
        }
        public int StartWay {
            get => startWay; 
            set { 
                startWay = value;
                NotifyPropertyChanged("StartWay");
            }  
        }
        public int Driver {
            get => driver; 
            set { 
                driver = value;
                NotifyPropertyChanged("Driver");
            }  
        }
        public string ExcelPath {
            get => excelPath; 
            set { 
                excelPath = value;
                NotifyPropertyChanged("ExcelPath");
            }  
        }
        public string OutExcelObj {
            get => outExcelObj; 
            set { 
                outExcelObj = value;
                NotifyPropertyChanged("OutExcelObj");
            }  
        }
        public string StartCode {
            get => startCode; 
            set { 
                startCode = value;
                NotifyPropertyChanged("StartCode");
            }
}
        public string SetCode {
            get => setCode; 
            set { 
                setCode = value;
                NotifyPropertyChanged("SetCode");
            }  
        }
        public string GetTranslateDriver() {
            switch(this.driver) {
                case 0:
                    return "自动检测";
                case 1:
                    return "Office";
                case 2:
                    return "Wps";
                default : return "自动检测";
            }
        }

        public string GetTranslateStartWay() {
            switch(this.startWay) {
                case 0:
                    return "打开已有Excel";
                case 1:
                    return "新建Excel";
                default : return "打开已有Excel";
            }
        }

        public override void SetLatestVarName(ConcurrentDictionary<string, ConcurrentDictionary<string, RPAVariableDefineWrapper>> globleData) {
            this.outExcelObj = this.GetLatestName(this.outExcelObj, globleData);
        }
    }
}
